import Vue from 'vue'
import Router from 'vue-router'
import HomeIndex from '@/components/index'
import Login from '@/components/login'
import Register from '@/components/register'
import Reset from '@/components/reset'

import Customer from '@/views/customer/index'
import Spread from '@/views/customer/index'
import CustomerList from '@/views/customer/customer_list'
import StoreList from '@/views/customer/store_list'
import Commucation from '@/views/customer/commucation'

import Finance from '@/views/finance/index'
import Dailyincome from '@/views/finance/dailyincome'
import Analysis from '@/views/finance/analysis/index'
import ChargeBackAnalysis from '@/views/finance/analysis/charge_back_analysis'
import GroupBuyAnalysis from '@/views/finance/analysis/groupbuy_analysis'
import OrderAnalysis from '@/views/finance/analysis/order_analysis'
import SalesAnalysis from '@/views/finance/analysis/sales_analysis'

import GroupBuy from '@/views/groupbuy/index'
import GroupBuyList from '@/views/groupbuy/groupbuy_list'

import Home from '@/views/home/index'

import Order from '@/views/order/index'
import OrderList from '@/views/order/order_list'
import ChargeBackList from '@/views/order/charge_back_list'

import Product from '@/views/product/index'
import ProductCategory from '@/views/product/product_category'
import ProductList from '@/views/product/product_list'

import Setting from '@/views/setting/index'
import ManagerList from '@/views/setting/manager_list'
import MenuConfig from '@/views/setting/menu_config'
import Profile from '@/views/setting/profile'
import ResetPwd from '@/views/setting/resetPwd'
import CharacterConfig from '@/views/setting/character_config'
import WechatConfig from '@/views/setting/wechat_config'
import CouponList from '@/views/spread/coupon_list'
import SpreadList from '@/views/spread/spread_list'

import 'font-awesome/css/font-awesome.css'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(Router)

export default new Router({
    routes: [{
        path: '/login',
        name: 'login',
        component: Login,
        meta: {
            title: '登录'
        }
    },
        {
            path: '/register',
            name: 'register',
            component: Register,
            meta: {
                title: '注册'
            }
        },
        {
            path: '/reset',
            name: 'reset',
            component: Reset,
            meta: {
                title: '重置密码'
            }
        },

        {
            path: '/',
            name: 'HomeIndex',
            component: HomeIndex,
            children: [{
                path: '/',
                name: 'home',
                component: Home,
                meta: {
                    title: '优机食汇',
                    crumb: '优机食汇 / 首页'
                },
            },
                {
                    path: 'setting',
                    name: 'Setting',
                    component: Setting,
                    children: [{
                        path: 'manager_list',
                        name: 'manager_list',
                        component: ManagerList,
                        meta: {
                            title: "管理员列表",
                            crumb: '基础配置 / 管理员列表'
                        }
                    },
                        {
                            path: 'menu_config',
                            name: 'menu_config',
                            component: MenuConfig,
                            meta: {
                                title: "菜单管理",
                                crumb: '基础配置 / 菜单管理'
                            }
                        },
                        {
                            path: 'wechat_config',
                            name: 'wechat_config',
                            component: WechatConfig,
                            meta: {
                                title: "微信配置",
                                crumb: '基础配置 / 微信配置'
                            }
                        },
                        {
                            path: 'character',
                            name: 'character',
                            component: CharacterConfig,
                            meta: {
                                title: "角色管理",
                                crumb: '基础配置 / 角色管理'
                            }
                        },
                        {
                            path: 'profile',
                            name: 'profile',
                            component: Profile,
                            meta: {
                                title: "个人信息",
                                crumb: '个人信息'
                            }
                        },
                        {
                            path: 'reset',
                            name: 'reset',
                            component: ResetPwd,
                            meta: {
                                title: "重置密码",
                                crumb: '重置密码'
                            }
                        }
                    ]
                },
                {
                    path: 'customer',
                    name: 'customer',
                    component: Customer,
                    children: [{
                        path: 'customer_list',
                        name: 'customer_list',
                        component: CustomerList,
                        meta: {
                            title: '客户列表',
                            crumb: '客户管理 / 客户列表'
                        }
                    },
                        {
                            path: 'store_list',
                            name: 'store_list',
                            component: StoreList,
                            meta: {
                                title: '经销商列表',
                                crumb: '客户管理 / 经销商列表'
                            }
                        },
                        {
                            path: 'commucation',
                            name: 'commucation',
                            component: Commucation,
                            meta: {
                                title: '商务洽谈',
                                crumb: '客户管理 / 商务洽谈'
                            }
                        }
                    ]
                },
                {
                    path: 'product',
                    name: 'product',
                    component: Product,
                    children: [{
                        path: 'product_list',
                        name: 'product_list',
                        component: ProductList,
                        meta: {
                            title: '商品列表',
                            crumb: '商品信息 / 商品列表'
                        }
                    },
                        {
                            path: 'product_category',
                            name: 'product_category',
                            component: ProductCategory,
                            meta: {
                                title: '商品种类',
                                crumb: '商品信息 / 商品种类'
                            }
                        }
                    ]
                },
                {
                    path: 'order',
                    name: 'order',
                    component: Order,
                    meta: {
                        title: '订单管理'
                    },
                    children: [{
                        path: 'order_list',
                        name: 'order_list',
                        component: OrderList,
                        meta: {
                            title: "订单列表",
                            crumb: '订单管理 / 订单列表'
                        }
                    },
                        {
                            path: 'charge_back_list',
                            name: 'charge_back_list',
                            component: ChargeBackList,
                            meta: {
                                title: "退款列表",
                                crumb: '订单管理 / 退款列表'
                            }
                        }
                    ]
                },
                {
                    path: 'groupbuy',
                    name: 'groupbuy',
                    component: GroupBuy,
                    children: [{
                        path: 'groupbuy_list',
                        name: 'groupbuy_list',
                        component: GroupBuyList,
                        meta: {
                            title: '团购列表',
                            crumb: '团购管理 / 团购列表'
                        }
                    }]
                },
                {
                    path: 'spread',
                    name: 'spread',
                    component: Spread,
                    children: [{
                        path: 'spread_list',
                        name: 'spread_list',
                        component: SpreadList,
                        meta: {
                            title: '广告管理',
                            crumb: '推广管理 / 广告列表'
                        }
                    },
                        {
                            path: 'coupon_list',
                            name: 'coupon_list',
                            component: CouponList,
                            meta: {
                                title: '优惠券管理',
                                crumb: '推广管理 / 优惠券列表'
                            }
                        }
                    ]
                },
                {
                    path: 'finance',
                    name: 'finance',
                    component: Finance,
                    children: [{
                        path: 'dailyincome',
                        name: 'dailyincome',
                        component: Dailyincome,
                        meta: {
                            title: '日常收支',
                            crumb: '财务管理 / 日常收支'
                        }
                    },
                        {
                            path: 'analysis',
                            name: 'analysis',
                            component: Analysis,
                            children: [{
                                path: 'charge_back_analysis',
                                name: 'charge_back_analysis',
                                component: ChargeBackAnalysis,
                                meta: {
                                    title: '退款统计',
                                    crumb: '财务管理 / 财务统计 / 退款统计'
                                }
                            },
                                {
                                    path: 'groupbuy_analysis',
                                    name: 'groupbuy_analysis',
                                    component: GroupBuyAnalysis,
                                    meta: {
                                        title: '团购统计',
                                        crumb: '财务管理 / 财务统计 / 团购统计'
                                    }
                                },
                                {
                                    path: 'order_analysis',
                                    name: 'order_analysis',
                                    component: OrderAnalysis,
                                    meta: {
                                        title: '订单统计',
                                        crumb: '财务管理 / 财务统计 / 订单统计'
                                    }
                                },
                                {
                                    path: 'sales_analysis',
                                    name: 'sales_analysis',
                                    component: SalesAnalysis,
                                    meta: {
                                        title: '销量统计',
                                        crumb: '财务管理 / 财务统计 / 销量统计'
                                    }
                                },
                            ]
                        }
                    ]
                }
            ]
        }

    ]
})
